{{define "dashboard/cron"}}
{{template "common/header" .}}
{{template "common/menu" .}}
<div class="nb-container">
    <div class="ui container">
        <div class="ui grid">
            <div class="right floated right aligned twelve wide column">
                <button class="ui right labeled positive icon button" onclick="addOrEditCron()"><i class="add icon"></i>
                    添加计划任务
                </button>
            </div>
        </div>
        <table class="ui very basic table">
            <thead>
                <tr>
                    <th>ID</th>
                    <th>名称</th>
                    <th>计划</th>
                    <th>命令</th>
                    <th>成功推送</th>
                    <th>执行者</th>
                    <th>最后执行</th>
                    <th>最后结果</th>
                    <th>管理</th>
                </tr>
            </thead>
            <tbody>
                {{range $cron := .Crons}}
                <tr>
                    <td>{{$cron.ID}}</td>
                    <td>{{$cron.Name}}</td>
                    <td>{{$cron.Scheduler}}</td>
                    <td>{{$cron.Command}}</td>
                    <td>{{$cron.PushSuccessful}}</td>
                    <td>{{$cron.ServersRaw}}</td>
                    <td>{{$cron.LastExecutedAt|tf}}</td>
                    <td>{{$cron.LastResult}}</td>
                    <td>
                        <div class="ui mini icon buttons">
                            <button class="ui button" onclick="manualTrigger(this, {{$cron.ID}})">
                                <i class="play icon"></i>
                            </button>
                            <button class="ui button" onclick="addOrEditCron({{$cron}})">
                                <i class="edit icon"></i>
                            </button>
                            <button class="ui button"
                                onclick="showConfirm('删除计划任务','确认删除此计划任务？',deleteRequest,'/api/cron/'+{{$cron.ID}})">
                                <i class="trash alternate outline icon"></i>
                            </button>
                        </div>
                    </td>
                </tr>
                {{end}}
            </tbody>
        </table>
    </div>
</div>
{{template "component/cron"}}
{{template "common/footer" .}}
{{end}}